import * as msg5000 from "./msg5000_csbuf";
import * as msg3000 from "./msg3000_csbuf";
import * as msg1200 from "./msg1200_csbuf";
import * as msg1100 from "./msg1100_csbuf";
import * as msg1000 from "./msg1000_csbuf";
import * as base from "./base_csbuf";

let _p1: {[key: number]: any;} = {};
let _p2: {[key: number]: any;} = {};
let _p3: {[key: number]: any;} = {};
let _p4: {[key: number]: any;} = {};
let _protocols = [_p1, _p2, _p3, _p4];

_protocols[0][1200] = msg1200.ChatMessage;
_protocols[0][1202] = msg1200.ChatMessageRecved;
_protocols[0][5000] = msg5000.GameInfoMJ;
_protocols[2][5001] = msg5000.Resp5001;
_protocols[2][5002] = msg5000.Resp5002;
_protocols[1][5003] = msg5000.Req5003;
_protocols[2][5003] = msg5000.Resp5003;
_protocols[1][5004] = msg5000.Req5004;
_protocols[2][5004] = msg5000.Resp5004;
_protocols[1][5005] = msg5000.Req5005;
_protocols[2][5005] = msg5000.Resp5005;
_protocols[1][5006] = msg5000.Req5006;
_protocols[2][5006] = msg5000.Resp5006;
_protocols[1][5007] = msg5000.Req5007;
_protocols[2][5007] = msg5000.Resp5007;
_protocols[2][5010] = msg5000.Resp5010;
_protocols[1][5011] = msg5000.Req5011;
_protocols[2][5011] = msg5000.Resp5011;
_protocols[2][5012] = msg5000.Resp5012;
_protocols[1][1101] = msg1100.Req1101;
_protocols[2][1101] = msg1100.Resp1101;
_protocols[1][1105] = msg1100.Req1105;
_protocols[2][1105] = msg1100.Resp1105;
_protocols[1][1102] = msg1100.Req1102;
_protocols[2][1102] = msg1100.Resp1102;
_protocols[2][1103] = msg1100.Resp1103;
_protocols[1][1104] = msg1100.Req1104;
_protocols[2][1104] = msg1100.Resp1104;
_protocols[1][1110] = msg1100.Req1110;
_protocols[2][1110] = msg1100.Resp1110;
_protocols[2][1111] = msg1100.Resp1111;
_protocols[1][1120] = msg1100.Req1120;
_protocols[2][1120] = msg1100.Resp1120;
_protocols[0][3000] = msg3000.CreateRoomRet;
_protocols[0][3010] = msg3000.CheckRoomRet;
_protocols[1][3001] = msg3000.Req3001;
_protocols[1][3002] = msg3000.Req3002;
_protocols[1][3003] = msg3000.Req3003;
_protocols[2][3003] = msg3000.Resp3003;
_protocols[1][3004] = msg3000.Req3004;
_protocols[2][3004] = msg3000.Resp3004;
_protocols[2][3005] = msg3000.Resp3005;
_protocols[1][3006] = msg3000.Req3006;
_protocols[2][3006] = msg3000.Resp3006;
_protocols[1][3007] = msg3000.Req3007;
_protocols[1][3008] = msg3000.Req3008;
_protocols[2][3008] = msg3000.Resp3008;
_protocols[2][3009] = msg3000.Resp3009;
_protocols[1][3020] = msg3000.Req3020;
_protocols[2][3020] = msg3000.Resp3020;
_protocols[1][3021] = msg3000.Req3021;
_protocols[2][3021] = msg3000.Resp3021;
_protocols[0][1] = msg1000.Err;
_protocols[1][2] = msg1000.RegisterUdpReq;
_protocols[2][2] = msg1000.RegisterUdpResp;
_protocols[1][3] = msg1000.Ping;
_protocols[2][3] = msg1000.Pong;
_protocols[1][5] = msg1000.NoticeReq;
_protocols[2][5] = msg1000.NoticeResp;
_protocols[1][6] = msg1000.OpinionReq;
_protocols[2][6] = msg1000.OpinionResp;
_protocols[1][8] = msg1000.RecvReq;

export function getProtocol(protoId, groupNumber) {
	if (groupNumber != undefined && groupNumber > 0) {
		let ret = _protocols[groupNumber][protoId]
		if (ret != undefined) {
			return ret
		}
	}
	return _protocols[0][protoId]
}

export * from "./msg5000_csbuf";
export * from "./msg3000_csbuf";
export * from "./msg1200_csbuf";
export * from "./msg1100_csbuf";
export * from "./msg1000_csbuf";
export * from "./base_csbuf";
